package client;

import java.awt.*;
import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 * User: Hp
 * Date: 23.04.11
 * Time: 19:42
 * To change this template use File | Settings | File Templates.
 */
public class PaintAction {
    protected static Random r = new Random();
    Color c;
    int seed;
    int x, y;
    private int ID;

    public Color getColor() {
        return c;
    }

    public void setColor(Color c) {
        this.c = c;
    }



    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }


    public PaintAction() {
        this.x = 0;
        this.y = 0;
        this.c = Color.BLACK;
        seed = r.nextInt();
    }
    public PaintAction(int x, int y) {
        this();
        this.x = x;
        this.y = y;
    }


    public void mouseEnter(int x, int y)
    {
        this.x=x;
        this.y=y;
    }
    public void mouseMove(int x, int y)
    {
        this.x=x;
        this.y=y;
    }
    public void mouseLeave(int x, int y)
    {
        this.x=x;
        this.y=y;
    }


    public void draw(Graphics2D gr){
        gr.setPaint(c);
        gr.fillOval(x - 1, y - 1, 3, 3);
    }

    public boolean equals(Object o)
    {
        if (o==null) return false;
        PaintAction pa = (PaintAction)o;
        if (pa==null) return false;
        return seed == pa.seed;
    }
}
